<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 transitional//EN" "http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

		<title>{$title}</title>
		<link type="text/css" href="__PUBLIC__/css/global.css" rel="stylesheet"/>
		<link type="text/css" href="__PUBLIC__/css/swfupload.css" rel="stylesheet"/>
		<link type="text/css" href="__PUBLIC__/css/jquery-ui.css" rel="stylesheet"/>
	</head>
	<script type="text/javascript" src="__PUBLIC__/js/jquery.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery-ui.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#letter").focus(function() {
				$("#letter").val("");
				$("#letter").attr("autocomplete","on");
			})
			$("#cancel").click(function() {
				$("#letter").attr("autocomplete","off");
				$("#letter").val("查找联系人...");
				$("#search div.groupsub").html("");
				$("#search").hide();
				$("#tree").show();
			})
			$("#letter").bind('propertychange', function() {
				if (($("#letter").val().length > 1) && ($("#letter").attr("autocomplete") == "on")) {
					$("#cancel").removeClass("lm_open");
					$("#cancel").addClass("lm_close");
					$("#tree").hide();
					$("#search").show();
					$.getJSON("{:U('json')}", {
						key : $("#letter").val()
					}, function(json) {
						$.each(json, function(i) {
							$("#search div.groupsub").append('<div><a class="lm_addr" selected="0" title="' + json[i].email + '" onmousedown="return false" href="javascript:void(0);"  >' + json[i].name + '</a></div>')
						})
						$(function() {
							$("#search a.lm_addr").click(function() {
								if ($(this).attr("selected") == '0') {
									$(this).attr("selected", "1");
									html = $(this).parent().html();
									$("#contact-dialog-right").append(html);
									title = $(this).attr("title");
									txt = jQuery.trim($("#contact-dialog-right a[title=" + title + ']').text());
									$("#contact-dialog-right a[title=" + title + ']').text(txt);
								}
							})
							$("#contact-dialog-right a.lm_addr").live('click', function() {
								email = $(this).attr("title");
								$("#search a[title=" + email + ']').attr("selected", "0");
								$(this).remove();
							})
						})
					});
				}
			})
			$("div.groupclose").toggle(function() {
				$("div.groupsub[key=" + $(this).attr("key") + "]").show();
				$(this).attr("class", "groupopen");
			}, function() {
				$("div.groupsub[key=" + $(this).attr("key") + "]").hide();
				$(this).attr("class", "groupclose");
			})
			$(function() {
				$("#tree a.lm_addr").click(function() {
					if ($(this).attr("selected") == '0') {
						$(this).attr("selected", "1");
						html = $(this).parent().html();
						$("#contact-dialog-right").append(html);
						sid = $(this).attr("sid");
						txt = jQuery.trim($("#contact-dialog-right a[sid=" + sid + ']').text());
						$("#contact-dialog-right a[sid=" + sid + ']').text(txt);
						$("#returnhtml", window.parent.document).html("");
						html = $("#contact-dialog-right").html();
						$("#returnhtml", window.parent.document).append(html);
					}
				})
				$("#contact-dialog-right a.lm_addr").live('click', function() {
					sid = $(this).attr("sid");
					$("#tree a[sid=" + sid + ']').attr("selected", "0");
					$(this).remove();
					$("#returnhtml", window.parent.document).html("");
					html = $("#contact-dialog-right").html();
					$("#returnhtml", window.parent.document).append(html);
				})
			})
		});
	</script>
	<style type="text/css">
		body {
			background-image: none;
			background-color: #fff
		}
		.cot {
			width: 420px;
			margin: auto;
		}
		.side_title {
			border-top: #a7c5e2 2px solid;
			background: #c1d9f3;
			line-height: 22px;
			padding-left: 10px;
			padding-right: 10px;
			height: 24px;
		}
		.side_content {
			line-height: 22px;
			padding-top: 6px;
			padding-bottom: 6px;
			padding-left: 10px;
			padding-right: 10px;
		}
		#contact-dialog-left {
			border: solid 1px #4e86c4;
		}
		#contact-dialog-right {
			border: solid 1px #4e86c4;
			OVERFLOW-X: hidden;
			WIDTH: 188px;
			HEIGHT: 325px;
			OVERFLOW: auto
		}
		#contact-dialog-right a {
			line-height: 21px;
		}
		.groupopen .lm_ca .lm_ico {
			display: inline-block;
			MARGIN: 2px 1px 0px 2px;
			WIDTH: 14px;
			BACKGROUND: url(/Public/images/contact_dialog.gif) no-repeat -80px -16px;
			HEIGHT: 12px;
			VERTICAL-ALIGN: middle;
		}
		.groupclose .lm_ca .lm_ico {
			display: inline-block;
			MARGIN: 2px 1px 0px 2px;
			WIDTH: 14px;
			PADDING-RIGHT: 0px;
			BACKGROUND: url(/Public/images/contact_dialog.gif) no-repeat -64px -16px;
			HEIGHT: 12px;
		}
		.lm_sopen {
			display: inline-block;
			BACKGROUND: url(/Public/images/contact_dialog.gif) no-repeat 0px -18px;
			width: 18px;
		}
		.lm_close {
			display: inline-block;
			BACKGROUND: url(/Public/images/contact_dialog.gif) no-repeat -32px -18px;
			width: 18px;
		}
		div.txt {
			border: solid 1px #336699;
			height: 20px;
			margin: 0;
			padding: 0;
		}
		.txt input {
			border: 0px;
			height: 20px;
			margin: 0;
			padding: 0;
			margin-left: 5px;
			width: 135px;
			line-height: 20px;
		}
		.groupsub {
			background: #ffffff;
		}
		.lm_ca {
			font-weight: bolder;
		}
		A.lm_addr:hover {
			BACKGROUND: #ffeec2
		}
		A.lm_addr {
			padding-left: 25px;
			display: block;
			width: 168px;
			overflow: hidden;
		}
		.lm_panel div {
			line-height: 21px;
		}
		.lm_panel {
			OVERFLOW-X: hidden;
			WIDTH: 190px;
			HEIGHT: 287px;
			OVERFLOW: auto
		}
	</style>
	<body>
		<div class="cot">
			<table style="width:400px">
				<tbody>
					<tr>
						<td style="width:190px;"> 联系人 </td>
						<td style="width:20px"> &nbsp; </td>
						<td style="width:190px;"> 收件人 </td>
					</tr>
					<tr>
						<td>
						<div id="contact-dialog-left">
							<div class="lm_sbar side_content clear">
								<div class="txt">
									<span id="cancel" class="lm_sopen fright" >&nbsp;</span>
									<input id="letter" class="fleft" value="查找联系人..." type="text" autocomplete="off">
								</div>
							</div>
							<div class="lm_panel" id="tree">
								<div class="groupopen" sub="0" key="t2">
									<div class="side_title">
										内部联系人
									</div>
								</div>
								<div class="groupsub" sub="1" key="t2">
									<volist name="list" id="dept">
										<div class="groupclose" sub="0" key="{$dept.id}">
											<div>
												<div class="lm_ca" title="{$dept.name}">
													<a nocheck="true" initlized="true" md="0">{$dept.level|u_str_pad=###-1,'&nbsp;&nbsp;&nbsp;'}<span class="lm_ico" type="button"></span>{$dept.name}</a>
												</div>
											</div>
										</div>
										<div style="display: none" class="groupsub" sub="1" key="{$dept.id}">
											<volist name="inside" id="vo">
												<eq name="vo.dept_id" value="$dept.id">
													<div class="groupclose" sub="0" key="{$emp.id}">
														<a class="lm_addr" sid="e{$vo.id}" selected="0" title="{$vo.email}" onmousedown="return false" href="javascript:void(0);"  >{$dept.level|u_str_pad=###-1,'&nbsp;&nbsp;&nbsp;'}{$vo.name}</a>
													</div>
												</eq>
											</volist>
										</div>
									</volist>
								</div>
								<div class="groupopen" sub="0" key="t2">
									<div class="side_title">
										公用联系人
									</div>
								</div>
								<div class="groupsub" sub="1" key="t2">
									<div class="groupsub" sub="1">
										<volist name="common" id="vo">
											<div class="groupclose" sub="0" key="{$emp.id}">
												<a class="lm_addr" sid="c{$vo.id}" selected="0" title="{$vo.email}" onmousedown="return false" href="javascript:void(0);"  >{$dept.level|u_str_pad=###-1,'&nbsp;&nbsp;&nbsp;'}{$vo.name}</a>
											</div>
										</volist>
									</div>
								</div>
								<div class="groupopen" sub="0" key="t2">
									<div class="side_title">
										私有联系人
									</div>
								</div>
								<div class="groupsub" sub="1" key="t2">
									<div class="groupsub" sub="1">
										<volist name="person" id="vo">
											<div class="groupclose" sub="0" key="{$emp.id}">
												<a class="lm_addr" sid="c{$vo.id}" selected="0" title="{$vo.email}" onmousedown="return false" href="javascript:void(0);"  >{$dept.level|u_str_pad=###-1,'&nbsp;&nbsp;&nbsp;'}{$vo.name}</a>
											</div>
										</volist>
									</div>
								</div>
							</div>
							<div style="DISPLAY: none" class="lm_panel" id="search">
								<div class="groupopen" sub="0" key="t2">
									<div class="side_title">
										搜索结果
									</div>
									<div class="groupsub" sub="1" key="t2">

									</div>
								</div>
							</div>
						</div></td>
						<td class="tacenter"><img src="__PUBLIC__/images/arrow_left.gif"/></td>
						<td><div style="OVERFLOW-Y: auto" id="contact-dialog-right"></div></td>
					</tr>
				</tbody>
			</table>
		</div>
	</body>
</html>
